package gat.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author sxq
 * @date 2021/12/17
 * <p>
 * 结算账户资金流动方向
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum DealTypeEnum {

    ONLINE_TOP_UP(1, "I", "在线充值"),
    OFFLINE_TOP_UP(2, "I", "线下充值"),
    PLACE_ORDER(3, "O", "下单"),
    REFUND(4, "I", "退款"),
    FREEZE(5, "-", "冻结"),
    THAW(6, "-", "资金解冻"),
    DEDUCT_FREEZE(7, "O", "用户提现扣除"),

    INVITATION_CASHBACK(8,"I","邀请注册返现")
    ;

    private Integer code;
    private String type;
    private String desc;

    public static DealTypeEnum getByCode(String code) {
        for (DealTypeEnum dealTypeEnum : values()) {
            if (String.valueOf(dealTypeEnum.getCode()).equals(code)) {
                return dealTypeEnum;
            }
        }
        return null;
    }
}
